#!/usr/bin/python3


def import_order(imports: list[str]):
    """
    排序导入语句
    """
    basis = [
        "com",
        "java",
        "javax",
        "org",
    ]
    return imports


def get_color_text(text: str, type: int):
    """
    获取带颜色的文字\n
    type 颜色类型；1：红色，2：黄色，3：绿色，4：蓝色
    """
    if type == 1:
        color_code = 31
    elif type == 2:
        color_code = 33
    elif type == 3:
        color_code = 32
    elif type == 4:
        color_code = 34
    return f"""\033[{color_code}m {text} \033[0m"""


def get_name_for_rename(name: str):
    """
    分析重命名表达式并获取名称字典
    """
    delimiter = "->"
    if delimiter in name:
        names = name.split(delimiter)
        old_name = names[0]
        new_name = names[1]
        name_dict = {"old_name": old_name, "new_name": new_name}
        return name_dict
    return name
